<%@ page language="java" isELIgnored="false" import="java.util.*"
	pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@page import="com.testingedu.model.TUser"%>	
<%TUser tUser  = (TUser)request.getAttribute("tUser"); %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title></title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/pingTai/pingTai.css">
		<script src="${pageContext.request.contextPath}/js/utils.js" type="text/javascript" language="javascript"></script>
		<SCRIPT type="text/javascript" language="javascript" src="${pageContext.request.contextPath}/js/jquery-1.7.2.js"></SCRIPT>
		<script type="text/javascript" src="${pageContext.request.contextPath}/js/My97DatePicker/WdatePicker.js"></script>
		<script charset="utf-8" src="${pageContext.request.contextPath}/editor/kindeditor.js"></script>
		<script charset="utf-8" src="${pageContext.request.contextPath}/editor/lang/zh_CN.js"></script>
<script>
        var editor;
        KindEditor.ready(function(K) {
                editor = K.create('#editor_id');
        });
</script>
<script type="text/javascript">
	$(document).ready(function(){
		$('#_yes').click(function(){
			$('#_em_1').css('display', 'block');
			$('#_em_2').css('display', 'block');
			$('#_td').attr('colspan',1);
		});
		$('#_no').click(function(){
			$('#_em_1').css('display', 'none');
			$('#_em_2').css('display', 'none');
			$('#_td').attr('colspan',3);
		});
	});
</script>
	</head>
	<body>
		<table width="100%" border="0" align="center" cellpadding="0"
			cellspacing="0">
			<tr>
				<td height="3"></td>
			</tr>
			<tr height="20" valign="baseline">
				<td bgcolor="#353c44">
					<img src="${pageContext.request.contextPath}/images/pingTai/tb.gif"
						width="14" height="14" />
					<span class="STYLE1">添加就业信息</span>
				</td>
				<td align="right" bgcolor="#353c44">
					<span class="STYLE1"> </span>
				</td>
			</tr>
			<tr>
				<td height="3" colspan="2"></td>
			</tr>
		</table>
		<form id="_form">
			<table width="100%" border="0" cellpadding="0" cellspacing="1"
				bgcolor="#a8c7ce">

				<tr bgcolor="#FFFFFF" class="STYLE19">
					<td align="left" colspan="4">
						学员：<font color="red"><%=tUser.getName() %></font>
						<input name="userId" type="hidden" value="<%=tUser.getId() %>">
					</td>
				</tr>
				<tr bgcolor="#FFFFFF" class="STYLE19">
					<td align="right">
						公司：
					</td>
					<td>
						<input type="text" name="comName" size="30" id="_comName">
					</td>
					<td align="right">
						职位：
					</td>
					<td>
						<input type="text" name="position" size="30" id="_position">
					</td>
				</tr>
				<tr bgcolor="#FFFFFF" class="STYLE19">
					<td align="right">
						薪水：
					</td>
					<td>
						<input type="text" name="money" size="30" id="_money">（人民币）
					</td>
					<td align="right">
						现在情况：
					</td>
					<td>
							未离职：<input type="radio" checked="checked" id="_no" name="em" value="no">&nbsp;&nbsp;&nbsp;已离职：<input type="radio" name="em" id="_yes" value="yes">
					</td>
				</tr>
				<tr bgcolor="#FFFFFF" class="STYLE19" id="_tr">
					<td align="right">
						加入时间：
					</td>
					<td colspan="3" id="_td">
						<input type="text" name="startTime" size="20"
							class="contact_input" value="<%=request.getAttribute("nowTime") %>"
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly" />
					</td>
					<td align="right">
						<div id="_em_1" style="display: none;">离职时间：</div>
					</td>
					<td>
						<input id="_em_2" style="display: none;" type="text" name="startTime" size="20"class="contact_input" value="<%=request.getAttribute("nowTime") %>"onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" readonly="readonly" />
					</td>
				</tr>
				<tr bgcolor="#FFFFFF" class="STYLE19">
					<td align="right" width="5%">
						描述:
					</td>
					<td width="5%" colspan="3">
						<textarea id="editor_id" name="description"
										style="width: 800px; height: 400px;">
									</textarea>
					</td>
				</tr>
				<tr bgcolor="#FFFFFF" class="STYLE19">
					<td colspan="4" align="center">
						<input type="button" class="button2" value="添加" onclick="save_to_employment();"/>
						<input type="reset" class="button2" value="重置" />
						<input type="button" class="button2" value="返回"
							onclick="javascript:history.go(-1);" />
					</td>
				</tr>
			</table>
		</form>
	</body>
	<script type="text/javascript">
function save_to_employment() {
	var comName = $('#_comName').val();
	if(!utils_stringLength(comName, '公司', 2, 40))
		return;
	var position = $('#_position').val();
	if(!utils_stringLength(position, '职位', 2, 40))
		return;
	var money = $('#_money').val();
	if(money.length == 0) {
		alert('薪水不能为空！');
		return;
	}
	if(!utils_price(money, '薪水'))
		return;
	editor.sync();
	$.ajax({
	   	type: "POST",
	   	url: "${pageContext.request.contextPath}/admin/employment/add",
	   	data: $('#_form').serialize(),
	   	dataType: "json",
	   	success: function(json){
     		if(json.msg != 'null')
     			alert(json.msg);
     		else {
     			if(json.id > 0) {
     				window.location.href="${pageContext.request.contextPath}/admin/employment/list?userId=<%=tUser.getId()%>";
     			}
     		}
   		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
   					alert("操作时发生了错误，请重试");
				},
		});
}
	</script>
</html>
